//
//  UIImage-Extension.h
//  HXPictureClippingRotation
//
//  Created by 黄轩 on 16/3/15.
//  Copyright © 2016年 黄轩 blog.libuqing.com. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface UIImage (CS_Extensions)

- (UIImage *)imageRotatedByRadians:(CGFloat)radians;
- (UIImage *)imageRotatedByDegrees:(CGFloat)degrees;

- (UIImage*)resizedImageToFitInSize:(CGSize)boundingSize scaleIfSmaller:(BOOL)scale;
- (UIImage*)resizedImageToSize:(CGSize)dstSize;
- (UIImage *)cropImage:(CGRect) rect;
- (UIImage *)fixOrientation;

//按比例缩放,size 是你要把图显示到 多大区域 CGSizeMake(300, 140)
-(UIImage *) imageCompressForSize:(UIImage *)sourceImage targetSize:(CGSize)size;

//指定宽度按比例缩放
-(UIImage *) imageCompressForWidth:(UIImage *)sourceImage targetWidth:(CGFloat)defineWidth;

/**  根据需要打入水印的图片和文字，重新返回绘制结束后的新的图片*/
/**  waterImage:打入水印的图片 */
/**  waterImageSize:打入水印的图片尺寸 */
+ (UIImage *)getNewImageWithOriginalImage:(UIImage *)originalImage
                               waterImage:(UIImage *)waterImage
                           waterImageSize:(CGSize)waterImageSize
                    waterImageMarginRight:(CGFloat)waterImageMarginRight
                   waterImageMarginBottom:(CGFloat)waterImageMarginBottom;

///给图片添加边框
+ (nonnull UIImage *)circleImageWithOriginImage:(UIImage *_Nullable)image
                                    borderColor:(UIColor *_Nullable)borderColor
                                    borderWidth:(CGFloat)borderWidth
                                         corner:(CGFloat)corner
                                      finalSize:(CGSize)finalSize;


///给图片加文字水印 传递一个要加水印的图片和水印的内容
+ (UIImage *)watermarkImage:(UIImage *_Nullable)img withName:(NSString *_Nullable)name;

@end


